package khs.java_macaddress.main.java;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws UnknownHostException, SocketException
    {
        InetAddress addr = InetAddress.getLocalHost();
        NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
        byte[] mac = ni.getHardwareAddress();
        
        String macAddr = "";
        for(int i=0;i<mac.length;i++){
            macAddr += String.format("%02X", mac[i]);
        }
        
        System.out.println(macAddr);
    }
}
